var findMedianSortedArrays = function(nums1, nums2) {
  nums1.push(...nums2);
  nums1.sort((a,b) => a-b);
  const mid = Math.floor((nums1.length - 1)/2) ;
  if(nums1.length === 1){
      return nums1[0];
  }
  if(nums1.length % 2 !== 0){
      return nums1[mid];
  }else{
      return (nums1[mid]+nums1[mid+1])/2;
  }
  
};
console.log(findMedianSortedArrays([3],[-2,-1]));